﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>任务待办</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link href="../Frozenui1.3/css/frozen.css" rel="stylesheet" />
    <script src="../JS/layer/layer.m.js"></script>
    <script src="../JS/zepto.min.js"></script>
    <script src="../Frozenui1.3/js/frozen.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script src="/Scripts/SZHLCommon.js"></script>
    <script src="../JS/MobileCom.js?v=1.1"></script>
    <script>
        var strId = ComFunJS.getQueryString("ID");
        var str = ComFunJS.getQueryString("t");
        var rwinfo = avalon.define({
            $id: "rwinfo",
            modelData: {},
            fzData: {},
            cyData: {},
            plData:{},
            plcount:0,
            js: function () {
                var tc = layer.open({
                    content: '确定要结束此任务吗？',
                    btn: ['确定', '取消'],
                    shadeClose: false,
                    yes: function () {
                        layer.close(tc);
                        var lg = $.loading({
                            content: '结束中...',
                        })
                        $.getJSON('/API/WXAPI.ashx?Action=COMPLETERCTX&r=' + Math.random(), { P1: strId, P2: "1" }, function (resultData) {
                            lg.hide();
                            if (resultData.ErrorMsg == "") {
                                $("#jsrw").hide();
                                var el = $.tips({
                                    content: "结束成功",
                                    stayTime: 2000,
                                    type: "success"
                                })
                                el.on("tips:hide", function () {
                                    window.location.reload();
                                })
                            }
                            else {
                                $.tips({
                                    content: "结束失败，原因：" + resultData.ErrorMsg,
                                    stayTime: 2000,
                                    type: "warn"
                                })
                            }
                        })
                    }, no: function () {
                    }
                })
            }
        });
        avalon.ready(function () {
            if (strId != null) {
                var lg = $.loading({
                    content: '加载中...',
                })
                $.getJSON('/API/WXAPI.ashx?Action=GETRCTXMODEL&r=' + Math.random(), { P1: strId }, function (resultData) {
                    lg.hide();
                    if (resultData.ErrorMsg == "") {
                        rwinfo.modelData = resultData.Result;
                        rwinfo.plData = resultData.Result1;
                        rwinfo.plcount = resultData.Result1.length;
                        if (resultData.Result.RWFZR != null) {
                            $.getJSON('/API/SZHLAPI.ashx?Action=GETUSERSBYUSERNAME&r=' + Math.random(), { P1: resultData.Result.RWFZR }, function (data) {

                                if (data.ErrorMsg == "") {
                                    rwinfo.fzData = data.Result;
                                }
                            })
                        }
                        if (resultData.Result.RWCYR != null) {
                            $.getJSON('/API/SZHLAPI.ashx?Action=GETUSERSBYUSERNAME&r=' + Math.random(), { P1: resultData.Result.RWCYR }, function (data) {

                                if (data.ErrorMsg == "") {
                                    rwinfo.cyData = data.Result;
                                }
                            })
                        }

                        if (str == "1" && rwinfo.modelData.RWStatus=="0")
                        {
                            $("#jsrw").show();
                        }
                    }
                })

            }

            $(".ui-btn").click(function () {
                var lg = $.loading({
                    content: '加载中...',
                })
                $.getJSON('/API/WXAPI.ashx?Action=ADDCOMENT&r=' + Math.random(), { "P1": $("#content").val(), "MsgType": "RCTX", "MsgLYID": strId }, function (resultData) {
                    lg.hide();
                    if (resultData.ErrorMsg == "") {
                        rwinfo.plData.push(resultData.Result);
                        rwinfo.plcount = rwinfo.plcount + 1;
                        var el = $.tips({
                            content: "评论成功！！",
                            stayTime: 2000,
                            type: "success"
                        })
                        $("#content").val("");
                    }
                    else {
                        var el = $.tips({
                            content: "评论失败！！",
                            stayTime: 2000,
                            type: "warn"
                        })
                    }
                })
            });

        })
        function rwzt(strzt) {
            if (strzt == "0") {
                return '正在进行';
            }
            else if (strzt == "1") {
                return '已结束';
            }
        }
    </script>
    <style>
        .ui-list > li {
            margin: 3px;
            padding-left: 15px;
        }
        .ui-form-item .wspan {
            width: 100%;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            -webkit-appearance: none;
            border: 0;
            background: 0 0;
            padding-left: 95px;
        }

        .ms-controller, [ms-controller] {
            display: none;
        }
    </style>
</head>
<body ms-controller="rwinfo">
    <header class="ui-header ui-header-stable ui-border-b">
        <i class="ui-icon-return" onclick="history.back(-1)"></i><h1>任务信息查看</h1>
    </header>
    <div class="ui-footer ui-footer-stable ui-btn-group ui-border-t">
        <section class="ui-input-wrap ui-border-t" style="width:100%">
            <div class="ui-input ui-border-radius">
                <input id="content" type="text" name="" value="" placeholder="我也说一句...">
            </div>
            <button class="ui-btn">评论</button>
        </section>
    </div>
    <section class="ui-container">
        <div class="ui-form ui-border-t">
            <div class="ui-form-item ui-border-b">
                <label>
                    类型
                </label>
                <span class="wspan">{{modelData.LeiBie}}</span>
            </div>
            <div class="ui-form-item ui-border-b" style="height:auto;min-height:44px">
                <label>
                    任务内容
                </label>
                <span class="wspan" ms-html="modelData.RWTitle"></span>
            </div>
            <div class="ui-form-item ui-border-b">
                <label>
                    截止时间
                </label>
                <span class="wspan">{{modelData.RWJZDate}}</span>
            </div>
            <div class="ui-form-item ui-border-b">
                <label>
                    任务状态
                </label>
                <span class="wspan">{{rwzt(modelData.RWStatus)}}</span>
                <a id="jsrw" class="ui-btn-lg ui-btn-primary" ms-click="js()" style="float: right; display: none;width: auto; height: 30px; line-height: 30px; margin-top: 7px;">结束</a>
            </div>
            <div class="ui-form-item ui-border-b" style="height:auto;min-height:44px">
                <label>
                    负责人
                </label>
                <div class="ui-label-list" style="padding-left: 95px; margin:0;">
                    <label ms-repeat-el="fzData" class="ui-label" style="position: relative; width: auto;">{{el.UserRealName}}</label>
                </div>
                <!--<span class="wspan">{{modelData.ChaoSongRen}}</span>-->
            </div>
            <div class="ui-form-item ui-border-b" style="height:auto;min-height:44px">
                <label>
                    参与人
                </label>
                <div class="ui-label-list" style="padding-left: 95px; margin:0;">
                    <label ms-repeat-el="cyData" class="ui-label" style="position: relative; width: auto;">{{el.UserRealName}}</label>
                </div>
                <!--<span class="wspan">{{modelData.ChaoSongRen}}</span>-->
            </div>
            <div class="ui-form" style="display:none;">
                <ul class="ui-grid-halve">
                    <li>
                        <div class="ui-grid-halve-img">
                            <span style="background-image:url(http://placeholder.qiniudn.com/290x160)"></span>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="ui-form-item ui-border-b">
                <label>
                    评论区
                </label>
                <span class="wspan">共 {{plcount}} 条评论</span>
            </div>
            <div class="ui-form ui-border-t" >
                <ul class="ui-list ui-list-pure">
                    <li class="ui-border ui-label-list" ms-repeat-el="plData">
                        <div style="display: -webkit-box;">
                            <div class="ui-avatar-s">
                                <span style="background-image:url(../img/ava1.png)"></span>
                            </div>
                            <div class="ui-list-info">
                                <h4>{{el.CRUserName}}</h4>
                            </div>
                            <div class="ui-list-info">
                                <p>{{el.CRDate|date("yyyy-MM-dd HH:mm")}}</p>
                            </div>
                        </div>
                        <p class="ui-txt-justify" ms-html="el.MSGContent"></p>
                    </li>
                </ul>
            </div>
        </div>
        

    </section>
</body>
</html>
